package com.cl.short_video_java.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

import lombok.Data;

/**
 * @TableName video_shop
 */
@TableName(value = "video_shop")
@Data
public class VideoShop implements Serializable {
	/**
	 * 商品表
	 */
	@TableId(type = IdType.AUTO)
	private Integer id;

	/**
	 * 商品名称
	 */
	private String title;

	/**
	 * 商品描述
	 */
	@TableField(value = "`desc`")
	private String desc;

	/**
	 * 价格
	 */
	private BigDecimal price;

	/**
	 * 折扣
	 */
	private Double discount;

	/**
	 * 商品排序
	 */
	private Integer sort;

	/**
	 * 是否上架：0-不上架，1-上架
	 */
	private Integer marketable;

	/**
	 * 商品首图
	 */
	private String imgUrl;

	/**
	 *
	 */
	private LocalDateTime createTime = LocalDateTime.now();

	/**
	 * 是否删除：0-正常，1-删除
	 */
	private Integer isDelete = 0;

	/**
	 * 购买次数
	 */
	private Long buyCount = 0L;
	private Integer type;
	private Integer date;
	private Integer dateUnit;
	@TableField(exist = false)
	private Integer gold;

	@TableField(exist = false)
	private BigDecimal payPrice;

	@TableField(exist = false)
	private static final long serialVersionUID = 1L;

	@Override
	public boolean equals(Object that) {
		if (this == that) {
			return true;
		}
		if (that == null) {
			return false;
		}
		if (getClass() != that.getClass()) {
			return false;
		}
		VideoShop other = (VideoShop) that;
		return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
				&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
				&& (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
				&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
				&& (this.getDiscount() == null ? other.getDiscount() == null : this.getDiscount().equals(other.getDiscount()))
				&& (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort()))
				&& (this.getMarketable() == null ? other.getMarketable() == null : this.getMarketable().equals(other.getMarketable()))
				&& (this.getImgUrl() == null ? other.getImgUrl() == null : this.getImgUrl().equals(other.getImgUrl()))
				&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
				&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
				&& (this.getBuyCount() == null ? other.getBuyCount() == null : this.getBuyCount().equals(other.getBuyCount()));
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
		result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
		result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
		result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
		result = prime * result + ((getDiscount() == null) ? 0 : getDiscount().hashCode());
		result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode());
		result = prime * result + ((getMarketable() == null) ? 0 : getMarketable().hashCode());
		result = prime * result + ((getImgUrl() == null) ? 0 : getImgUrl().hashCode());
		result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
		result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
		result = prime * result + ((getBuyCount() == null) ? 0 : getBuyCount().hashCode());
		return result;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", title=").append(title);
		sb.append(", desc=").append(desc);
		sb.append(", price=").append(price);
		sb.append(", discount=").append(discount);
		sb.append(", sort=").append(sort);
		sb.append(", marketable=").append(marketable);
		sb.append(", imgUrl=").append(imgUrl);
		sb.append(", createTime=").append(createTime);
		sb.append(", isDelete=").append(isDelete);
		sb.append(", buyCount=").append(buyCount);
		sb.append(", serialVersionUID=").append(serialVersionUID);
		sb.append("]");
		return sb.toString();
	}
}